package com.example.pt.entity;


import org.springframework.data.annotation.Id;
import org.springframework.data.elasticsearch.annotations.DateFormat;
import org.springframework.data.elasticsearch.annotations.Document;
import org.springframework.data.elasticsearch.annotations.Field;
import org.springframework.data.elasticsearch.annotations.FieldType;

import java.sql.Date;

@Document(indexName = "user_index")
public class UserES {

    @Id
    private int uid;


    @Field(type = FieldType.Text, analyzer = "ik_max_word", searchAnalyzer = "ik_smart")
    private String username;

    @Field(type = FieldType.Text)
    private String password;

    @Field(type = FieldType.Text)
    private String email;

    @Field(type = FieldType.Text)
    private String headshot;

    //0是管理员 ，1是用户
    @Field(type = FieldType.Integer)
    private int usertype;
    @Field(type = FieldType.Integer)
    private int points;
    @Field(type = FieldType.Integer)
    private int level;

    @Field(type = FieldType.Date, format = DateFormat.date_hour_minute_second)
    private Date registerDate;

    @Field(type = FieldType.Date, format = DateFormat.date_hour_minute_second)
    private Date lastTime;

    // 用户状态：0-正常，1-被封禁，2-下载分享不符合规范
    @Field(type = FieldType.Integer)
    private Integer status;

    //首次违规时间，缓冲期为1周7天
    @Field(type = FieldType.Date, format = DateFormat.date_hour_minute_second)
    private Date bufferDay;

    public int getUid() {
        return uid;
    }
    public void setUid(int uid) {
        this.uid = uid;
    }
    public void setLevel(int level) {
        this.level = level;
    }
    public int getLevel() {
        return level;
    }
    public String getUsername() {
        return username;
    }
    public void setUsername(String username) {
        this.username = username;
    }
    public String getPassword() {
        return password;
    }
    public void setPassword(String password) {
        this.password = password;
    }
    public String getEmail() {
        return email;
    }
    public void setEmail(String email) {
        this.email = email;
    }
    public String getHeadshot() {
        return headshot;
    }
    public void setHeadshot(String headshot) {
        this.headshot = headshot;
    }
    public int getUsertype() {
        return usertype;
    }
    public void setUsertype(int usertype) {
        this.usertype = usertype;
    }
    public int getPoints() {
        return points;
    }
    public void setPoints(int points) {
        this.points = points;
    }

    public Integer getStatus() {
        return status;
    }

    public void setStatus(Integer status) {
        this.status = status;
    }

    public Date getRegisterDate() {
        return registerDate;
    }
    public void setRegisterDate(Date registerDate) {
        this.registerDate = registerDate;
    }
    public Date getLastTime() {
        return lastTime;
    }
    public void setLastTime(Date lastTime) {
        this.lastTime = lastTime;
    }
    public void setBufferDay (Date bufferDay) {
        this.bufferDay = bufferDay;
    }
    public Date getBufferDay() {
        return bufferDay;
    }
}
